package com.hopes.bizz.close.statistic.controller;

import com.hopes.bizz.close.gis.service.ClosedInOutService;
import com.hopes.bizz.close.statistic.service.ClosedInOutStatisticService;
import com.hopes.boss.common.core.util.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yumr
 * @ProjectName bizz
 * @Description 卡口统计分析
 * @time 2024/1/30 10:37
 */

@RestController
@RequiredArgsConstructor
@RequestMapping("/statistic")
@Tag(description = "statistic", name = "出入园统计分析")
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
public class ClosedInOutStatisticController {

    private final ClosedInOutService closedInOutService;
    private final ClosedInOutStatisticService closedInOutStatisticService;

    /**
     * 出入园统计分析
     * @param beginTime   开始时间
     * @param endTime     截止时间
     * @return
     */
    @Operation(summary = "出入园统计分析", description = "出入园统计分析")
    @GetMapping("/enterOuterParkChart")
    public R queryEnterOuterParkChart(@RequestParam("beginTime") String beginTime, @RequestParam("endTime") String endTime) {
        return R.ok(closedInOutService.queryEnterOuterChart(beginTime, endTime));
    }

    /**
     * 卡口车辆进出统计图表
     * @param beginTime   开始时间
     * @param endTime     截止时间
     * @return
     */
    @Operation(summary = "卡口车辆进出统计图表", description = "卡口车辆进出统计图表")
    @GetMapping("/singleGateCarChart")
    public R querySingleGateCarChart(@RequestParam("gateId") Long gateId, @RequestParam("beginTime") String beginTime, @RequestParam("endTime") String endTime) {
        return R.ok(closedInOutService.querySingleGateCarChart(gateId, beginTime, endTime));
    }

    /**
     * 门禁人员进出统计图表
     * @param beginTime   开始时间
     * @param endTime     截止时间
     * @return
     */
    @Operation(summary = "门禁人员进出统计图表", description = "门禁人员进出统计图表")
    @GetMapping("/singleAccessPersonChart")
    public R querySingleAccessPersonChart(@RequestParam("accessId") Long accessId, @RequestParam("beginTime") String beginTime, @RequestParam("endTime") String endTime) {
        return R.ok(closedInOutStatisticService.querySingleAccessPersonChart(accessId, beginTime, endTime));
    }



}
